package com.ljwm.seckill.dto;

import com.ljwm.seckill.entity.SuccessKilled;
import com.ljwm.seckill.enums.SeckillState;
import lombok.Data;

/**
 * Created by yuzhou on 2017/8/6.
 */
@Data
public class SeckillExecution {

  private long seckillId;

  // 秒杀结果状态
  private int state;

  // 状态表示
  private String stateInfo;

  // 秒杀成功对象
  private SuccessKilled successKilled;

  // 成功时构造
  public SeckillExecution(long seckillId, SeckillState seckillState, SuccessKilled successKilled) {
    this.seckillId = seckillId;
    this.state = seckillState.getState();
    this.stateInfo = seckillState.getStateInfo();
    this.successKilled = successKilled;
  }

  // 失败时构造
  public SeckillExecution(long seckillId, SeckillState seckillState) {
    this.seckillId = seckillId;
    this.state = seckillState.getState();
    this.stateInfo = seckillState.getStateInfo();
  }
}
